<!doctype html>
<%@page contentType="text/html;charset=UTF-8"%>
<jsp:directive.page import="com.cn.ccp.bean.UserBean" />
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<html>
<f:view>
<f:loadBundle var="messages" basename="messages"></f:loadBundle>
<head>
<meta charset="utf-8">
<title><h:outputText value="#{messages['system_title']}" /></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- styles -->
    <link href="<%=request.getContextPath()%>/css/bootstrap.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/css/bootstrap-responsive.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/css/custom.css" rel="stylesheet">
    <!--[if lt IE 9]>
      <script src="../../js/html5.js"></script>
    <![endif]-->
    <!-- Fav and touch icons -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-57-precomposed.png">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/images/icon/favicon.png">
    <%
		UserBean users = (UserBean) session.getAttribute("userBean");
			if ((users == null) || (users.getUserName().equals(""))) {
	%>
		<jsp:forward page="../../sessionInvalid.jsp" />
	<%
	}
	%>
</head>

<body class="bg-white" style="overflow-x:hidden;">
<a id="viewDiv"></a>
	<h:form id="formid">
		<h:inputHidden value="#{teacherCourseIssueAction.courseID}" ></h:inputHidden>
		<div class="content">
			<div class="row page-head">
				<h3 class="page-title">
					<i class="n-icon-laptop n-icon-black"></i>
					<h:outputText value="#{messages['online_page_study_title']}"/>&nbsp;&gt;&nbsp;<b><h:outputText value="#{messages['online_page_select_action_quest']}" />(<h:outputText value="#{teacherCourseIssueAction.courseName}" />)</b>
				</h3>
			</div>

			<div style="margin-left: 20px; margin-right: 20px">
				<fieldset>
                   	<div class="form-white">
                   		<a4j:outputPanel ajaxRendered="true">
           				<a4j:repeat id="repeatid" var="content" value="#{teacherCourseIssueAction.questionList}" >
           					<f:verbatim>
           					<div class="issue">
	                            <h5>
	                            </f:verbatim>
	                            <h:outputText value="#{content.answerMsg}" escape="false" ></h:outputText>
	                            <a4j:commandLink value="#{messages['label_reply']}"  style="margin-left: 10px;" action="#{teacherCourseIssueAction.selectReplyStudent}" reRender="replyStudentName,currTime,currQuestionId,currQuestionStudentId,contentid">
	                            	<f:param name="cqid" value="#{content.id}"></f:param>
	                            	<f:param name="studentName" value="#{content.studentName}"></f:param>
	                            	<f:param name="studentId" value="#{content.student_id}"></f:param>
	                            </a4j:commandLink>
	                            </h5>
	                            <f:verbatim>
	                            <p>
	                            </f:verbatim>
	                            	<h:outputText value="#{content.issue}"></h:outputText>
	                            <f:verbatim>
	                            </p>
	                            <hr />
	 							</div>
                            </f:verbatim>
                            
                            <a4j:repeat var="qswcontent" value="#{content.ccList}" >
	           					<f:verbatim>
	           					<div class="answer">
		                            <h5>
		                            </f:verbatim>
		                            <h:outputText value="#{qswcontent.answerMsg}" escape="false" ></h:outputText>
		                            <f:verbatim>
		                            </h5>
		                            <p>
		                            </f:verbatim>
		                            	<h:outputText value="#{qswcontent.issue}"></h:outputText>
		                            	<a4j:commandLink value="#{messages['btn_delete']}" style="margin-left: 10px;" action="#{teacherCourseIssueAction.delAnwser}" onclick="if(!confirm('#{messages['label_delete_sure']}？')){return false;}"  styleClass="text-error" reRender="replyStudentName,currTime,currQuestionId,currQuestionStudentId,contentid" >
	                            			<f:param name="cqid" value="#{qswcontent.id}"></f:param>
	                            		</a4j:commandLink>
		                            <f:verbatim>
		                            </p>
		                            <hr />
		 							</div>
	                            </f:verbatim>
	                    	</a4j:repeat>
                    	</a4j:repeat>
                    	</a4j:outputPanel>
                    	<h:panelGrid columns="2" styleClass="pagination pagination-right" style="align:right" >
							<h:panelGrid columns="4" >
								<a4j:commandLink action="#{teacherCourseIssueAction.firstPage}" styleClass="icon-fast-backward"  reRender="showInfoListid"></a4j:commandLink>
								<a4j:commandLink action="#{teacherCourseIssueAction.provPage}" styleClass="icon-backward" reRender="showInfoListid"></a4j:commandLink>
								<a4j:commandLink action="#{teacherCourseIssueAction.nextPage}" styleClass="icon-forward" reRender="showInfoListid"></a4j:commandLink>
								<a4j:commandLink action="#{teacherCourseIssueAction.lastPage}" styleClass="icon-fast-forward" reRender="showInfoListid"></a4j:commandLink>
							</h:panelGrid>
							<h:panelGroup>
								<a4j:outputPanel ajaxRendered="true">
									<h:inputText value="#{teacherCourseIssueAction.currentPage}" size="3" styleClass="input" style="width:20px"></h:inputText>
									<h:inputHidden value="#{teacherCourseIssueAction.itemCount}"></h:inputHidden>
									<h:outputText value="#{teacherCourseIssueAction.countPage}#{messages['label_page']}"></h:outputText>
				
									<a4j:commandLink action="#{teacherCourseIssueAction.goCurrentPage}"
										reRender="showInfoListid">
										<h:graphicImage value="../../../images/BtnPageGo.gif"></h:graphicImage>
									</a4j:commandLink>
									<h:outputText value="#{messages['label_all']}#{teacherCourseIssueAction.itemCount}#{messages['label_count']}"></h:outputText>
								</a4j:outputPanel>
							</h:panelGroup>
						</h:panelGrid>
                        <div class="answer">
	                        <a4j:outputPanel ajaxRendered="true">
	                        	<h:inputHidden value="#{teacherCourseIssueAction.currQuestionId}" />
	                        	<h:inputHidden value="#{teacherCourseIssueAction.currQuestionStudentId}" />
	                        	<h:inputHidden value="#{teacherCourseIssueAction.currQuestionStudentName}"/>
                        	</a4j:outputPanel>
                            <h5><h:outputText value="#{messages['label_reply']}" /> 
                            <h:outputText id="replyStudentName" value="#{teacherCourseIssueAction.currQuestionStudentName}"/>： <small><h:outputText id="currTime" value="#{teacherCourseIssueAction.currData}" /> </small>
                           </h5>
                           	<div class="control-group">
                            	<h:inputTextarea id="contentid" value="#{teacherCourseIssueAction.content}" styleClass="input-block-level" rows="3"></h:inputTextarea>
                        	</div>
                        	<a4j:commandButton value="#{messages['btn_submit']}" styleClass="btn btn-primary" action="#{teacherCourseIssueAction.save}" reRender="contentid,repeatid,replyStudentName,currTime" />
                        	<input type= "button" value= "返回" onclick= "history.back()" class="btn" style="margin-left: 20px;" />
							 <a4j:outputPanel ajaxRendered="true">
								<h:message for="contentid" style="color:red"></h:message>
							</a4j:outputPanel>
                            <hr />
                        </div>
                        
                        
                        
                    </div>
                  </fieldset>
			</div>
			<!-- /.content -->
		</div>
	</h:form>
	<script src="<%=request.getContextPath()%>/js/jquery-1.8.3.min.js"></script>
	<script src="<%=request.getContextPath()%>/js/bootstrap.js"></script>
	<script>
		function changeIssue(issueId){
			document.getElementById("formid:currQuestionId").value = issueId;
		}
	</script>
	<script type="text/javascript">
$(document).ready(function() {
	//document.getElementById('viewDiv').scrollIntoView();
});</script>
</body>
</f:view>
</html>
